package com.gjl.fasong;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@Component
@RestController
public class FaController {

    //类上同样添加@Component
    @Autowired
    private AmqpTemplate amqpTemplate;
    @RequestMapping("reabbitSend")
    public void sendMessageWithAmqp(){
        amqpTemplate.convertAndSend("fanoutExchange","","传递消息");
    }
        //可以使用测试类也可以在类上添加@Restcontroller或@controller进行测试

    @RequestMapping("reabbitSend2")
    public void sendMessageWithAmqp2(){
        amqpTemplate.convertAndSend("fasonghelloword","","hello word");
    }
}
